﻿// OperationResultExtensions.cs

using System.Diagnostics;

public static class OperationResultExtensions
{
    private static readonly NumberInChineseProvider numberInChineseProvider = new NumberInChineseProvider();
    public static string MultiplicationToChinese(this BinaryOperationTable<int, int>.Result result)
    {
        Debug.Assert(result.Sign is "*");

        var str1 = numberInChineseProvider.GetString(result.Input1);
        var str2 = numberInChineseProvider.GetString(result.Input2);

        var resultStr = numberInChineseProvider.GetString(result.Output)
            .PadLeft(2, '得')
            .Replace("得十", "一十");

        return $"{str1}{str2}{resultStr}";
    }
}